package oa.core;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import oa.web.pojo.Employee;

import com.ndktools.javamd5.Mademd5;

public class Constant {

	//set some cookie properties
	public static int COOKIE_MAX_AGE = 24*60;
	
	//set log status
	public static int  LOGIN_STATUS_ERRORPASSWORD = 0;
	public static int LOGIN_STATUS_ERRORUSERNAME = 1;
	public static int LOGIN_STATUS_LOGIN_SUCCESS = 2;
	
	//set session attributes
	public static String CURRENT_USER = "CURRENT_USER";
	
	//attend type
	public static final int ZHENGCHANG = 1;
	public static final int SHIJIA = 1;
	public static final int BINGJAI = 1;
	public static final int CHIDAO = 1;
	public static final int ZAOTUI = 1;
	public static final int KUANGGONG = 1;
	public static final int CHUCHAI = 1;
	
	public static Mademd5 getInstance(){
		return new Mademd5 ();
	}
	
	public static Employee getEmp(HttpServletRequest req) {
		HttpSession session = MySession.getInstance(req);
		Employee emp = null;
		try {
			emp = (Employee) session.getAttribute(Constant.CURRENT_USER);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return emp;
	}
}
